(* Using the trapeodial rule with interval halving to evalute*)
Remove["Global`*"]
f[x_]=Log[Cos[x]]; 
{a,b}={0,1};
n = 50;
h=(b-a)/n;
s = f[a];
For[i = 1, i≤n-1,i=i+1,
xi =a+h*i;
s=s+2*f[xi];
]
s=s+f[b];
N[h*s/2,4]
N[NIntegrate[Log[Cos[x]],{x,0,1}],4]